<template>
    <el-dialog title="完成审计" :visible.sync="dialogVisible" width="20%" :before-close="handleClose">
        <h3 class="dialog_title">审计意见</h3>
        <el-input type="textarea" v-model="opinion" placeholder="请输入审计意见" />
        <span slot="footer" class="dialog-footer">
            <el-button @click="handleClose">取 消</el-button>
            <el-button type="primary" @click="submitClick">确 定</el-button>
        </span>
    </el-dialog>
</template>
<script>
import { upAuditLogInfo, upAuditOperate } from "@/api/system/logininfor";
export default {
    data() {
        return {
            opinion: '',
            dialogVisible: false,
            btnType: 1,
            itemIds: ''
        }
    },
    methods: {
        // type 1登录日志完成审计 2操作日志审计
        openDialog(ids, type) {
            this.itemIds = ids;
            this.btnType = type;
            this.dialogVisible = true;
        },
        handleClose() {
            this.dialogVisible = false;
            this.opinion = '';
        },
        //确认
        submitClick() {
            const data = {
                auditOpinion: this.opinion,
            }
            if (this.btnType === 1) {
                data.infoIds = this.itemIds,
                upAuditLogInfo(JSON.stringify(data)).then(() => {
                    this.$modal.msgSuccess("操作成功");
                    this.handleClose();
                    this.$emit('auditSuccess');
                })
            } else {
                data.operIds = this.itemIds
                upAuditOperate(JSON.stringify(data)).then(() => {
                    this.$modal.msgSuccess("操作成功");
                    this.handleClose();
                    this.$emit('auditSuccess');
                })
            }
        }
    },
}
</script>
<style scoped>
.dialog_title {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}
</style>